<template>
  <div class="test">
    <!-- Form -->
    <el-button type="text" @click="dialogFormVisible = true">打开嵌套表单的 Dialog</el-button>

    <el-dialog title="信息修改" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="图片标题" :label-width="formLabelWidth">
          <el-input v-model="form.imgTitle" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="图片类别" :label-width="formLabelWidth">
          <el-select v-model="form.imgCategory" placeholder="请选择图片类别">
            <el-option v-for="(category,index) in categorys" :key="index" :label="category" :value="category"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="制作人" :label-width="formLabelWidth">
          <el-select v-model="form.imgClassification" placeholder="请选择图片制作人">
            <!-- <el-option label="传媒学院 张明" value="传媒学院 张明"></el-option>
            <el-option label="美术学院 王华威" value="美术学院 王华威"></el-option> -->
            <el-option v-for="(classification,index) in classifications" :key="index" :label="classification" :value="classification"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="点击量" :label-width="formLabelWidth">
          <el-input-number v-model="form.numberOfHits" label="描述文字"></el-input-number>
        </el-form-item>
        <el-form-item label="图片描述" :label-width="formLabelWidth">
          <el-input type="textarea" autocomplete="off" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="form.imgDescribe"></el-input>
          <!-- <el-input v-model="form.imgDescribe"></el-input> -->
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import image_url from './image_url.js'
import admin_image_url from './admin_url.js'
export default {
  data() {
    return {
      dialogFormVisible: false,
      categorys: [],
      classifications:[],
      image: {},
      form: {
        imgTitle: '',
        imgCategory: '',
        imgClassification: '',
        imgDescribe: '',
        numberOfHits: 0,
      },
      formLabelWidth: '120px'
    };
  },
  created(){
    // 类别选项
    this.$axios({
        url: admin_image_url[1].url,
    }).then(res => {
        this.categorys = res.data;
    })
    // 制作人选项
    // this.$axios({
    //     url: admin_image_url[1].url,
    // }).then(res => {
    //     this.categorys = res.data;
    // })
    
  }
};
</script>